package com.itheima.d14_polimorphicDemo;

public class Computer {
    /**
     * 提供安装USB方法
     */
    public void Install(USB usb){
        usb.plugIn();

        if(usb instanceof Keyboard){
            Keyboard keyboard = (Keyboard) usb;
            keyboard.type();
        }else if (usb instanceof Mouse){
            Mouse mouse = (Mouse) usb;
            mouse.click();
        }
        usb.pullOut();
    }
}
